/**
 * @(#) Operation.java
 */

package cn.edu.sjtu.se.dslab.component.data;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import cn.edu.sjtu.se.dslab.component.method.InterfaceMethod;

@Entity
@Table(name = "operation")
public class Operation implements Serializable {
	private static final long serialVersionUID = 1L;

	private long id;

	private InterfaceMethod interfaceMethod;

	private DomainEntity entity;

	@ManyToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "data_entity_id")
	public DomainEntity getEntity() {
		return entity;
	}

	public void setEntity(DomainEntity entity) {
		this.entity = entity;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@ManyToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "method_id")
	public InterfaceMethod getInterfaceMethod() {
		return interfaceMethod;
	}

	public void setInterfaceMethod(InterfaceMethod interfaceMethod) {
		this.interfaceMethod = interfaceMethod;
	}

}
